<?php /* @var $reaction Reaction */ ?>
<?php use_helper('Date')?>

<div id="reactions-opposites" class="content group">
	<?php if (count($opposites_reactions) > 0): ?>
	<?php foreach($opposites_reactions as $reaction):?>
	<div class="group opposite-reaction">
		<div class="avatar">
			<?php
				$className = $reaction->getUser()->getShowProfile() == 1 ? 'class=profile profile-'.$reaction->getUser()->getId() : '';
				echo image_tag($reaction->getUser()->getThumbnailUrl(), 'alt='.$reaction->getUser()->getName().' '.$className);
			?>
		</div>

		<div class="perfect">
			<h4 class="group">
				<span>
					<strong class="profile profile-<?php echo $reaction->getUser()->getId()?>">
						<?php echo $reaction->getUser()->getName()?>
					</strong>
					<?php if($reaction->getUser()->getCountry() || $reaction->getUser()->getOrigin()):?>
						(<?php if($reaction->getUser()->getCountry()) echo $reaction->getUser()->getCountry()?>
						<?php if($reaction->getUser()->getCountry() && $reaction->getUser()->getOrigin()):?> - <?php endif;?>
						<?php if($reaction->getUser()->getOrigin()): ?><em><?php echo $reaction->getUser()->getOrigin()?></em><?php endif; ?>)
					<?php endif; ?>
				</span>

				<?php
					$percentage = $user->getOppositenessWith($reaction->getUser());
					$className  = Round(Round($percentage)/10) * 10;
				?>		
				<span class="oppositeness-<?php echo $className?>"><?php echo Round($percentage) ?>%</span>
			</h4>
			<p><?php echo $reaction->getText() ?></p>
			<?php if($reaction->getVideoCode()): ?>
				<?php include_partial('global/lypo_video',array('video_type' => $reaction->getVideoType(), 'video_code' => $reaction->getVideoCode())); ?>
			<?php endif; ?>
			<p class="meta group">
				<span class="respects">
					<img src="http://<?php echo $basehost?>/images/gadget/respect-icon-gbg.gif" alt="Respect" />
					&times; <?php echo $reaction->getNumRespects() ? $reaction->getNumRespects() : '0' ?>

					<?php if (isset($respected_reaction_ids[$reaction->getId()]) || $reaction->getUser()->getId() == $user->getId()):?>
						<span>
					<?php else: ?>
						<span class="respect respect-<?php echo $reaction->getId()?>">
					<?php endif; ?>
						Respect!
					</span>
				</span>
				<span class="date"><?php echo sprintf('%s ago',time_ago_in_words($reaction->getCreatedAt("U"))) ?></span>
			</p>
		</div>
	</div>
	<?php endforeach; ?>
	<?php else: ?>
	<p>You have not selected anyone as a perfect opposite</p>
	<?php endif; ?>
</div>
